<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>点餐系统登录页面</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico"> <link href="__CSS__/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__CSS__/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="__CSS__/animate.css" rel="stylesheet">
    <link href="__CSS__/style.css?v=4.1.0" rel="stylesheet">
    <link href="__CSS__/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="__CSS__/login.css" rel="stylesheet">
    <!-- 全局js -->
    <script src="__JS__/jquery.min.js?v=2.1.4"></script>
    <script src="__JS__/bootstrap.min.js?v=3.3.6"></script>
    <script src="__JS__/plugins/validate/jquery.validate.min.js"></script>
    <script src="__JS__/plugins/validate/messages_zh.min.js"></script>
    <script src="__JS__/plugins/sweetalert/sweetalert.min.js"></script>
    <script src="__JS__/order/common.js"></script>
</head>
<style>
     
    .logo-back img{
        width:260px;
        margin:30px;
    }
    h1,h2{
        text-align:center;
    }
    /* body.signin{
         
        background:url("__PUBLIC__/img/a.jpg") no-repeat center fixed;
    }    */
</style>
<body class="signin">
    <div class="signinpanel">
        <div class="row">
            <div class="col-sm-6">
                <div class="signin-info">
                    <div class="logopanel m-b">
                    </div>
                    <div class="logo-back">
                        <img src="__IMG__/logo.jpg" alt="" style='border-radius:50%;margin:20% 30px'>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <h2>点餐机后台管理</h2>
                <form class="m-t" role="form" onsubmit="return false;" id='login'>
                    <div class="form-group">
                        <input type="" class="form-control uname" name='name' placeholder="用户名" required="">
                    </div>
                    <div class="form-group">
                        <input type="password" class="form-control pword" name='password' placeholder="密码" required="">
                    </div>
                    <button  type='submit' class="btn btn-success block full-width m-b" id='submit'>登 录</button>
                </form>
            </div>
        </div>
        <div class="signup-footer">
            <div class="pull-left">
                &copy; 2017 All Rights Reserved. 山西创客空间科技有限公司
            </div>
        </div>
    </div>
</body>
</html>
<script>
    $(function () {
        (function () {
            var submitBtn = document.getElementById('submit');
            var icon = "<i class='fa fa-times-circle'></i> ";
            submitBtn.addEventListener('click',function () {
                $('#login').validate({
                    onsubmit:true,// 是否在提交是验证  
                    onfocusout:false,// 是否在获取焦点时验证  
                    onkeyup :false,// 是否在敲击键盘时验证 
                    rules: {
                        name: "required",
                        password: "required",
                    },
                    messages:{
                        name:icon + "用户名不能为空",
                        password:icon + "密码不能为空",
                    },
                    submitHandler:function (e) {
                        var formData = $('#login').serialize();
                        async('../Login/logincheck','post',formData,function (data) {
                        	if (data.code == -1) {
                                var errorMessage = data.message;
                                swal({
                                    title: "登录失败",
                                    text: errorMessage,
                                },function () {
                                    
                                });
                            }
                            if (data.code == 0) {
                                window.location.href = '../Index/index';
                                
                            }
                        });
       
                    }
                })
            },false);
        })();
    })
</script>
